package com.fanyue.modules.wzb.service.impl;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.fanyue.core.base.BaseServiceImpl;
import com.fanyue.core.cache.CoolCache;
import com.fanyue.core.exception.CoolPreconditions;
import com.fanyue.core.request.R;
import com.fanyue.core.util.CoolSecurityUtil;
import com.fanyue.core.util.DatabaseDialectUtils;
import com.fanyue.modules.base.entity.sys.BaseSysDepartmentEntity;
import com.fanyue.modules.base.service.sys.BaseSysDepartmentService;
import com.fanyue.modules.wzb.entity.AppUserEntity;
import com.fanyue.modules.wzb.entity.AppUserFaceEntity;
import com.fanyue.modules.wzb.entity.ClothingSpecEntity;
import com.fanyue.modules.wzb.mapper.AppUserFaceMapper;
import com.fanyue.modules.wzb.mapper.AppUserMapper;
import com.fanyue.modules.wzb.service.AppUserFaceService;
import com.fanyue.modules.wzb.service.AppUserService;
import com.fanyue.modules.wzb.service.ClothingSpecService;
import com.fanyue.modules.wzb.utils.FaceApiUtils;
import com.fanyue.modules.wzb.vo.AppUserImportVO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.tangzc.autotable.core.constants.DatabaseDialect;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.fanyue.modules.base.entity.sys.table.BaseSysDepartmentEntityTableDef.BASE_SYS_DEPARTMENT_ENTITY;
import static com.fanyue.modules.wzb.entity.table.AppUserEntityTableDef.APP_USER_ENTITY;
import static com.fanyue.modules.wzb.entity.table.AppUserFaceEntityTableDef.APP_USER_FACE_ENTITY;


/**
 * 系统用户
 */
@Service
@RequiredArgsConstructor
public class AppUserFaceServiceImpl extends BaseServiceImpl<AppUserFaceMapper, AppUserFaceEntity> implements AppUserFaceService {

    final private CoolCache coolCache;
    final private BaseSysDepartmentService sysDepartmentService;
    final private ClothingSpecService clothingSpecService;

    @Override
    public Object list(JSONObject requestParams, QueryWrapper queryWrapper) {
        Long userId = requestParams.getLong("userId");
        queryWrapper.from(APP_USER_FACE_ENTITY);
        if (userId != null) {
            queryWrapper.and(APP_USER_FACE_ENTITY.USER_ID.eq(userId));
        }
        return mapper.selectListByQuery(queryWrapper);
    }



}